import request from '@/utils/request'
import qs from 'qs'
import store from '@/store'
// 通过渠道编码获取租户信息 
export const getChannelinfo = () => {
  return request({
    url: `/web-service/channelClientConfig/info?channelCode=${store.getters['channelCode']}`,
    method: 'get'
  })
}
export const wxMiniCorpLogin = (data) => {
  return request({
    url:  `/blade-auth/oauth/token?code=${data.code}&grant_type=qywx&scope=all&state=wxlogin&source=WECHAT_ENTERPRISE&tenantId=${data.tenantId}`,
    method: 'post'
  })
}

// 获取JSSDK
export const getSignService = (data) => {
  const querydata = qs.stringify(data)
  return request({
    url: `/crm-service/qw/ticket?${querydata}`,
    method: 'get'
  })
}
// 换取code
export const getUserInfo = () => {
  return request({
    url: `/blade-system/user/info`,
    method: 'get'
  })
}

// 登出
export const logout = () => {
  return request({
    url: '/parentLogin/logout',
    method: 'post'
  })
}
// 检查是否有重名
export const parentLogincheckNameDuplicate = (data) => {
  const querydata = qs.stringify(data)
  return request({
    url: `/parentLogin/checkNameDuplicate?${querydata}`,
    method: 'get'
  })
}
